import Taro, { Component } from '@tarojs/taro'
import { View, Image, Text } from '@tarojs/components'
import { AtButton, } from 'taro-ui'
// import { DNavBar } from '@/components'
// import http from '@/api'
import './index.scss'

export default class JoinEnterprise extends Component {
    state = {
        title: '',
        enterpriseIcon: require('../../../assets/images/icon／企业@2x.png'),
        authIcon: require('../../../assets/images/icon／认证@2x.png'),
        entId: '',
        imName: '',
    }

    componentDidMount() {
        const { entId, imName, entName, manager } = this.$router.params
        if (entName) {
            document.title = decodeURIComponent(entName)
        }

        this.setState({
            entId,
            imName: decodeURIComponent(imName),
            entName: decodeURIComponent(entName),
            manager: decodeURIComponent(manager),
        })
    }



    render() {
        const { enterpriseIcon, authIcon, imName, entId, entName, manager } = this.state
        return (
            <View className="join_enterprise">

                <View className="container">
                    <View className="content">
                        <View className="content_title">{imName}邀请你加入：</View>
                        <View className="content_body">
                            <Image src={enterpriseIcon} className="enterprise_icon"></Image>
                            <Text className="enterprise_name">{entName}</Text>
                            <View className="enterprise_info">
                                <Image src={authIcon} className="enterprise_info_icon"></Image>
                                <Text>企业已认证</Text>
                                <Text>｜</Text>
                                <Text>创建人：{manager}</Text>
                            </View>
                        </View>

                        <AtButton onClick={() => {
                            Taro.navigateTo({
                                url: '/pages/myEnterprise/applyJoin?entId=' + entId
                            })
                        }}>加入企业</AtButton>
                    </View>
                </View>
            </View>
        )
    }
}
